package com.price.compare.common;

import java.util.*;

public enum MaterialColEnum {
    Material_ID("Material ID","id")
    ,MATERIAL_MATERIALCODE("物料号","materialCode")
    ,MATERIAL_MATERIALSHORTTEXT("物料短描述","materialShortText")
    ,MATERIAL_MATERIALLONGTEXT("物料长描述","materialLongText")
    ,MATERIAL_MONEY("未税报价","money")
    ;

    /**
     * Excel列名
     */
    private String title;

    /**
     * 属性名
     */
    private String objName;

    MaterialColEnum(String title, String objName) {
        this.title = title;
        this.objName = objName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getObjName() {
        return objName;
    }

    public void setObjName(String objName) {
        this.objName = objName;
    }


    public static Map<String, String> getObjNameMap() {
        Map<String, String> colMap = new HashMap<>();
        for (MaterialColEnum obj : MaterialColEnum.values()) {
            colMap.put(obj.getTitle(), obj.getObjName());
        }
        return colMap;
    }


    public static String[] getHeadersNoSettlement() {
        List<String> list = new ArrayList<>();
        for (MaterialColEnum obj : MaterialColEnum.values()) {
            list.add(obj.getTitle());
        }
        String[] array = Arrays.stream(list.toArray()).toArray(String[]::new);
        return array;
    }


    public static String[] getHeaders() {
        int size = MaterialColEnum.values().length;
        String[] array = new String[size];
        int i = 0;
        for (MaterialColEnum obj : MaterialColEnum.values()) {
            array[i] = obj.getTitle();
            i++;
        }
        return array;
    }

    public static String[] getProsNoSettlement() {
        List<String> list = new ArrayList<>();
        for (MaterialColEnum obj : MaterialColEnum.values()) {
            list.add(obj.getObjName());
        }
        String[] array = Arrays.stream(list.toArray()).toArray(String[]::new);
        return array;
    }


    public static String[] getPros() {
        int size = MaterialColEnum.values().length;
        String[] array = new String[size];
        int i = 0;
        for (MaterialColEnum obj : MaterialColEnum.values()) {
            array[i] = obj.getObjName();
            i++;
        }
        return array;
    }

}
